import React from "react";
import { Toast, NavBar, Empty, Button, Cell, Image } from "react-vant";
import { useNavigate } from "react-router-dom";
import './style.css'
const Index: React.FC = () => {
  const navigate = useNavigate();
  let img = JSON.parse(localStorage.getItem("info")!);
  let user = localStorage.getItem("user");
  const tu=()=>{
    localStorage.clear()
    navigate('/login')
  }
  const bb=()=>{
    Toast.info('已是最新版本')
  }
  const ld=()=>{
    console.log("亮度")
    navigate("/screenbrightness")
  }
  const xg=()=>{
    console.log("修改密码")
    navigate("/changepassword")
  }
  return (
    <div>
      <NavBar title="设置" onClickLeft={() => navigate(-1)} />
      <Cell
        center
        title={user}
        icon={<Image width={44} height={44} src={img} round />}
        isLink
      />
      <Cell title="修改密码" isLink onClick={()=>xg()}/>
      <Cell title="清除缓存" isLink value="10MB" />
      <Cell title="屏幕亮度" isLink onClick={()=>ld()}/>
      <Cell title="版本检测" isLink onClick={()=>bb()}/>
      <Cell title="帮助中心" isLink />
      <Cell title="关于我们" isLink />
      <Cell title="邀请好友" isLink />
       <Button color='#7232dd' plain onClick={()=>tu()} id="tudlbtn">
        退出登录
      </Button>
    </div>
  );
};
export default Index;
